import React from 'react';
import ReactDOM from 'react-dom';

// import 'antd-mobile/lib/button/style/index.css';
// import Button from 'antd-mobile/lib/button';

import { Router, Route, hashHistory, IndexRoute, Link } from 'react-router';

import App from './components/App';
import Stage1 from './components/Stage1';
import Stage2 from './components/Stage2';
import Stage3 from './components/Stage3';
// import MyMenu from './components/tabBars/user/main/myMenu';
import Login from './components/tabBars/user/login/login';
import Register from './components/tabBars/user/register/register';
import Details from './components/tabBars/user/details/details';
import UserSetting from './components/user/usersetting';
import Security from './components/tabBars/user/setting/security';
import UpdatePwd from './components/tabBars/user/password/updatePwd'
import ForgetPwd from './components/tabBars/user/password/forgetPwd';
import ModifyImg from './components/user/modifyImg';
import SupplierApply from './components/tabBars/user/setting/supplierApply';
import ModifyMsg from './components/tabBars/user/details/modifyMsg';
import AnserComfirm from './components/tabBars/user/password/anserComfirm';
import Main from './components/tabBars/home/home';
import Bar from './components/tabBars/main/tabBar';
// import TabBarExample from './components/tabBars/demo/test';
import GoodsDetails from './components/tabBars/mall/details/goodsDetails';
//cjy import
import ChooseAddr from './components/tabBars/car/chooseAddrs';
import AddAddr from './components/tabBars/car/addAddr';
import OederFills from './components/tabBars/car/orderFills';
import Goods from './components/tabBars/car/goods';

import './index.less';

if (localStorage.getItem("isLogin") == null){
    localStorage.setItem("isLogin",0);
}
if (sessionStorage.getItem("selectTab") == null){
    sessionStorage.setItem("selectTab","mainTab");
}
// class Index extends React.Component {
//     render() {
//         // if (sessionStorage.getItem("isLogin") == null){
//             sessionStorage.setItem("isLogin",0);
//         // }
//         // console.log(localStorage.getItem("isLogin"));
//         return (
//             <div className="body">
//                 <h1>Stages list</h1>
//                 <ul role="nav">
//                     <li><Link to="/s1">ListView + Carousel</Link></li>
//                     <li><Link to="/s2">Tabs + ...</Link></li>
//                     <li><Link to="/s3">Form + ...</Link></li>
//                     <li><Link to="/myMenu">我的</Link></li>
//                 </ul>
//             </div>
//         );
//     }
// }

ReactDOM.render(
    <Router history={hashHistory}>
        <Route path="/" component={App}>
            <IndexRoute component={Bar} />
            <Route path="s1" component={Stage1} />
            <Route path="s2" component={Stage2} />
            <Route path="s3" component={Stage3} />
            {/*<Route path="myMenu" component={MyMenu}/>*/}
            <Route path="login" components={Login}/>
            <Route path="register" components={Register}/>
            {/*<Route path="/myMenu/:userId" component={MyMenu}/>*/}
            <Route path="/user/details" component={Details}/>
            <Route path="/user/usersetting" component={UserSetting}/>
            <Route path="/user/security" component={Security}/>
            <Route path="/user/updatePwd" component={UpdatePwd}/>
            <Route path="/user/forgetPwd" component={ForgetPwd}/>
            <Route path="/user/modifyImg" component={ModifyImg}/>
            <Route path="/user/supplierApply" component={SupplierApply}/>
            <Route path="/user/modifyMsg" component={ModifyMsg}/>
            <Route path="/user/anserComfirm" component={AnserComfirm}/>
            <Route path="/goodsDetails" component={GoodsDetails}/>
            <Route path="/car/chooseAddrs" component={ChooseAddr}/>
            <Route path="/car/addAddr" component={AddAddr}/>
            <Route path="/car/orderFills" component={OederFills}/>
            <Route path="/car/goods" component={Goods}/>

            {/*<Route path="test" component={TabBarExample}/>*/}
        </Route>
    </Router>
    , document.getElementById('example'));
